﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.quest.Display.QuestManager {
    import flash.display.*;
    import org.aswing.*;
    import Classes.*;
    import org.aswing.geom.*;
    import flash.text.*;
    import Display.aswingui.*;

    public class QuestManagerToolTip extends JPanel {

        public static const TEXT_WIDTH:int = 170;

        protected var m_bgAsset:DisplayObject;
        protected var m_centerPanel:JPanel;

        public function QuestManagerToolTip(_arg1:LayoutManager=null){
            super(new SoftBoxLayout(SoftBoxLayout.X_AXIS, 5, SoftBoxLayout.CENTER));
            this.setPreferredSize(new IntDimension(QuestManagerView.QUEST_MANAGER_TOOLTIP_WIDTH, QuestManagerView.QUEST_MANAGER_TOOLTIP_HEIGHT));
            this.makeBackground();
        }
        public function emptyToolTip():void{
            this.removeAll();
        }
        public function initializeToolTip(_arg1:String="", _arg2:Array=null, _arg3:Array=null):void{
            var _local6:String;
            var _local7:int;
            var _local8:Object;
            var _local9:String;
            var _local10:Item;
            this.emptyToolTip();
            this.m_centerPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.TOP, 5);
            this.m_centerPanel.append(ASwingHelper.verticalStrut((QuestManagerUI.TOP_INSET_HEIGHT + 30)));
            var _local4:Component = ASwingHelper.makeMultilineText(_arg1, TEXT_WIDTH, EmbeddedArt.TITLE_FONT, TextFormatAlign.LEFT, 18, EmbeddedArt.whiteTextColor);
            this.m_centerPanel.append(_local4);
            _local4 = ASwingHelper.makeMultilineText(ZLoc.t("Quest", "quest_manager_overview_tasks"), TEXT_WIDTH, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, TextFormatAlign.LEFT, 18, EmbeddedArt.blueTextColor);
            this.m_centerPanel.append(_local4);
            var _local5:int;
            for each (_local6 in _arg2) {
                _local4 = ASwingHelper.makeMultilineText(_local6, TEXT_WIDTH, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, TextFormatAlign.LEFT, 12, EmbeddedArt.whiteTextColor);
                this.m_centerPanel.append(_local4);
            };
            _local4 = ASwingHelper.makeMultilineText(ZLoc.t("Quest", "quest_manager_overview_rewards"), TEXT_WIDTH, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, TextFormatAlign.LEFT, 18, EmbeddedArt.yellowTextColor);
            this.m_centerPanel.append(_local4);
            _local7 = 0;
            while (_local7 < _arg3.length) {
                _local8 = _arg3[_local7];
                if (_local8["resource"] != "xpromo"){
                    _local9 = ZLoc.t("Quest", ("reward_" + String(_local8.resource)), {amount:int(_local8.amount)});
                    if (((!((_local8.itemName == null))) && (!((_local8.itemName == ""))))){
                        _local10 = Global.gameSettings.getItemByName(_local8.itemName);
                        _local9 = _local10.localizedName;
                    };
                    if (((!((_local8.loc == ""))) && (!((_local8.loc == null))))){
                        _local9 = ZLoc.t("Dialogs", _local8.loc, {reward:_local9});
                    };
                    _local4 = ASwingHelper.makeMultilineText(_local9, TEXT_WIDTH, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, TextFormatAlign.LEFT, 12, EmbeddedArt.whiteTextColor);
                    this.m_centerPanel.append(_local4);
                };
                _local7++;
            };
            this.m_centerPanel.append(ASwingHelper.verticalStrut(QuestManagerUI.TOP_INSET_HEIGHT));
            this.append(ASwingHelper.horizontalStrut(10));
            this.append(this.m_centerPanel);
            this.setMaximumHeight(this.m_centerPanel.getPreferredHeight());
            ASwingHelper.prepare(this);
        }
        protected function makeBackground():void{
            this.m_bgAsset = (new (QuestManagerView.assetDict["questManagerBG"])() as DisplayObject);
            var _local1:MarginBackground = new MarginBackground(this.m_bgAsset, new Insets((QuestManagerUI.TOP_INSET_HEIGHT + 30)));
            this.setBackgroundDecorator(_local1);
        }

    }
}//package Modules.quest.Display.QuestManager 
